package com.zy.ServletFilter;

import javax.servlet.*;
import java.io.IOException;

//注解方式配置
//@WebFilter("/*")//访问所有资源时都会先执行该过滤器,拦截路径
public class FilterDemo1 implements Filter
{

    @Override
    public void init(FilterConfig filterConfig) throws ServletException
    {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
    {
        System.out.println("Filter1过滤器被执行----");

        //放行
        filterChain.doFilter(servletRequest,servletResponse);
    }
    @Override
    public void destroy()
    {

    }
}
